import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:namewava/jc_tabbar.dart';
import 'package:namewava/utils/jc_cache.dart';
import 'package:namewava/utils/jc_global.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await JcCache.preInit();
  configLoading();
  // JcCache.getInstance().setData("key4", 11.1);
  // var value1 = JcCache.getInstance().get("key1");

  SystemUiOverlayStyle systemUiOverlayStyle = const SystemUiOverlayStyle(
    statusBarColor: Colors.transparent,
  );
  SystemChrome.setSystemUIOverlayStyle(systemUiOverlayStyle);
  runApp(const MyApp());
}

configLoading() {
  EasyLoading.instance
    ..displayDuration = const Duration(milliseconds: 2000)
    ..indicatorType = EasyLoadingIndicatorType.fadingCircle
    ..loadingStyle = EasyLoadingStyle.dark
    ..indicatorSize = 45.0
    ..radius = 10.0
    ..progressColor = Colors.yellow
    ..backgroundColor = Colors.green
    ..indicatorColor = Colors.yellow
    ..textColor = Colors.yellow
    ..maskColor = Colors.blue.withOpacity(0.5)
    ..userInteractions = true
    ..dismissOnTap = false;
  // ..customAnimation = CustomAnimation();
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return JcGlobal(
        waveLogin: 'security/oauth',
        waveConfig: 'config/getAppConfig',
        waveStrategy: 'config/getStrategy',
        waveValidToken: 'security/isValidToken',
        waveUserInfo: 'user/getUserInfo',
        wavePolicy: 'user/oss/policy',
        waveSaveUserInfo: 'user/saveUserInfo',
        waveUpdateAvatar: 'user/updateAvatar',
        waveGoods: 'coin/goods/search',
        waveCreateRecharge: 'coin/recharge/create',
        waveRechargeCheck: 'coin/recharge/payment/ipa',
        waveCoinsSpend: 'coin/reviewModeConsume',
        waveLogout: 'security/logout',
        waveDeleteAccount: 'user/deleteAccount',
        waveLogUp: 'log/live-chat',
        baseUrl: 'http://test-app.bigegg.work/',///http://test-app.cosmofusionly.xyz/
        baseLogUrl: 'http://log.bigegg.work/',
        child: const JcTabbar());
  }
}
